<!DOCTYPE HTML>
<html>

<head>
	<link rel="bookmark"  type="image/x-icon"  href="/img/logo_miccall.png"/>
	<link rel="shortcut icon" href="/img/logo_miccall.png">
	
			    <title>
    Ame雨
    </title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
    <link rel="stylesheet" href="/amelin-ting/css/mic_main.css" />
    <link rel="stylesheet" href="/amelin-ting/css/dropdownMenu.css" />
    <meta name="keywords" content="Ame雨" />
    
    	<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
	 
    <noscript>
        <link rel="stylesheet" href="/amelin-ting/css/noscript.css" />
    </noscript>
    <style type="text/css">
        body:before {
          content: ' ';
          position: fixed;
          top: 0;
          background: url('/amelin-ting/img/bg.jpg') center 0 no-repeat;
          right: 0;
          bottom: 0;
          left: 0;
          background-size: cover; 
        }
    </style>

			    
  
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script async type="text/javascript" src="//cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
  


    <script src="/amelin-ting/js/jquery.min.js"></script>
    <script src="/amelin-ting/js/jquery.scrollex.min.js"></script>
    <script src="/amelin-ting/js/jquery.scrolly.min.js"></script>
    <script src="/amelin-ting/js/skel.min.js"></script>
    <script src="/amelin-ting/js/util.js"></script>
    <script src="/amelin-ting/js/main.js"></script>
	
<meta name="generator" content="Hexo 5.4.0"></head>
    
		
<!-- Layouts -->



<!--  代码渲染  -->
<link rel="stylesheet" href="/css/prism_coy.css" />
<link rel="stylesheet" href="/css/typo.css" />
<!-- 文章页 -->
<body class="is-loading">
    <!-- Wrapper 外包 s-->
    <div id="wrapper" class="fade-in">
        <!-- Intro 头部显示 s -->
        <!-- Intro 头部显示 e -->
        <!-- Header 头部logo start -->
        <header id="header">
    <a href="/amelin-ting/" class="logo">Art Space</a>
</header>
        <!-- Nav 导航条 start -->
        <nav id="nav" class="special" >
            <ul class="menu links" >
			<!-- Homepage  主页  --> 
			<li >
	            <a href="/amelin-ting/" rel="nofollow">主页</a>
	        </li>
			<!-- categories_name  分类   --> 
	        
	        <li class="active">
	            <a href="#s1">分类</a>
	                    <ul class="submenu">
	                        <li>
	                        <a class="category-link" href="/amelin-ting/categories/Go/">Go</a></li><li><a class="category-link" href="/amelin-ting/categories/django/">django</a></li><li><a class="category-link" href="/amelin-ting/categories/drf/">drf</a></li><li><a class="category-link" href="/amelin-ting/categories/gin/">gin</a></li><li><a class="category-link" href="/amelin-ting/categories/go/">go</a></li><li><a class="category-link" href="/amelin-ting/categories/linux/">linux</a></li><li><a class="category-link" href="/amelin-ting/categories/mysql/">mysql</a></li><li><a class="category-link" href="/amelin-ting/categories/python/">python</a></li><li><a class="category-link" href="/amelin-ting/categories/%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F/">内网穿透</a></li><li><a class="category-link" href="/amelin-ting/categories/%E5%89%8D%E7%AB%AF/">前端</a>
	                    </ul>
	        </li>
	        
	        <!-- archives  归档   --> 
	        
	        
		        <!-- Pages 自定义   -->
		        
		        <li>
		            <a href="/about/" title="简历">
		                简历
		            </a>
		        </li>
		        
		        <li>
		            <a href="/group/" title="团队">
		                团队
		            </a>
		        </li>
		        
		        <li>
		            <a href="/gallery/" title="图库">
		                图库
		            </a>
		        </li>
		        
		        <li>
		            <a href="/tag/" title="标签">
		                标签
		            </a>
		        </li>
		        


            </ul>
            <!-- icons 图标   -->
			<ul class="icons">
                    
                    <li>
                        <a title="github" href="https://github.com/miccall" target="_blank" rel="noopener">
                            <i class="icon fa fa-github"></i>
                        </a>
                    </li>
                    
                    <li>
                        <a title="500px" href="http://500px.com" target="_blank" rel="noopener">
                            <i class="icon fa fa-500px"></i>
                        </a>
                    </li>
                    
			</ul>
</nav>

        <div id="main" >
            <div class ="post_page_title_img" style="height: 25rem;background-image: url(https://img0.baidu.com/it/u=3501170617,3501059228&amp;fm=26&amp;fmt=auto);background-position: center; background-repeat:no-repeat; background-size:cover;-moz-background-size:cover;overflow:hidden;" >
                <a href="#" style="padding: 4rem 4rem 2rem 4rem ;"><h2 >djangoAuth</h2></a>
            </div>
            <!-- Post -->
            <div class="typo" style="padding: 3rem;">
                <h2 id="一、auth模块前戏"><a href="#一、auth模块前戏" class="headerlink" title="一、auth模块前戏"></a>一、auth模块前戏</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">我们在执行数据库迁移命令会自动生成很多表</span></span><br><span class="line"><span class="string">auth_user</span></span><br><span class="line"><span class="string">django在启动之后就可以做直接访问admin路由，需要输入用户名和密码，数据参考的就是auth_user表，并且还必须是管理员用户才能进入</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">创建超级用户(管理员)</span></span><br><span class="line"><span class="string">python3 manage.py createsuperuser</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br></pre></td></tr></table></figure>

<h2 id="二、auth模块的使用"><a href="#二、auth模块的使用" class="headerlink" title="二、auth模块的使用"></a>二、auth模块的使用</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span> 代码演示</span><br><span class="line"><span class="comment"># views</span></span><br><span class="line">    <span class="keyword">from</span> django.shortcuts <span class="keyword">import</span> render, HttpResponse, redirect</span><br><span class="line">    <span class="keyword">from</span> django.contrib <span class="keyword">import</span> auth</span><br><span class="line">    <span class="keyword">from</span> django.contrib.auth.decorators <span class="keyword">import</span> login_required</span><br><span class="line">    <span class="keyword">from</span> django.contrib.auth.models <span class="keyword">import</span> User</span><br><span class="line"></span><br><span class="line">    <span class="comment"># Create your views here.</span></span><br><span class="line"></span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    我们再用auth的时候 用就用全套的auth提供的方法</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">form_input</span>(<span class="params">request</span>):</span></span><br><span class="line">        <span class="comment"># 判断是否为POST</span></span><br><span class="line">        <span class="keyword">if</span> request.method == <span class="string">&#x27;POST&#x27;</span>:</span><br><span class="line">            <span class="comment"># 获取前端输入内容</span></span><br><span class="line">            username = request.POST.get(<span class="string">&#x27;username&#x27;</span>)</span><br><span class="line">            password = request.POST.get(<span class="string">&#x27;password&#x27;</span>)</span><br><span class="line">            <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">            验证密码 有两道难题</span></span><br><span class="line"><span class="string">            1.表在哪</span></span><br><span class="line"><span class="string">            2.密文怎么对比</span></span><br><span class="line"><span class="string">            &quot;&quot;&quot;</span></span><br><span class="line">            <span class="comment"># 直接用auth模块即可，但是要注意必须把两个参数传进去才行</span></span><br><span class="line">            user_obj = auth.authenticate(username=username, password=password)</span><br><span class="line">            <span class="built_in">print</span>(user_obj)  <span class="comment"># 用户对象 如果上述账号密码不正确则返回一个None</span></span><br><span class="line">            <span class="comment"># 登陆成功即保存用户数据</span></span><br><span class="line">            auth.login(request, user_obj)  <span class="comment"># 为什么不用session方法，因为我们用全套的auth方法，而且用了这个auth方法不管在哪你都能request.user拿到登录用户</span></span><br><span class="line">            <span class="keyword">return</span> redirect(<span class="string">&#x27;/home/&#x27;</span>)</span><br><span class="line">        <span class="keyword">return</span> render(request, <span class="string">&#x27;form_input.html&#x27;</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="meta">    @login_required</span></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">home</span>(<span class="params">request</span>):</span></span><br><span class="line">        <span class="built_in">print</span>(request.user)  <span class="comment"># 依然是用户对象，如果不登录直接拿就是匿名用户</span></span><br><span class="line">        <span class="comment"># 我们可以用这个内置方法来判断是不是匿名用户</span></span><br><span class="line">        <span class="built_in">print</span>(request.user.is_authenticated)</span><br><span class="line">        <span class="keyword">return</span> HttpResponse(<span class="string">&#x27;welcome&#x27;</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="meta">    @login_required</span></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">set_password</span>(<span class="params">request</span>):</span></span><br><span class="line">        <span class="comment"># 检测是否为POST</span></span><br><span class="line">        <span class="keyword">if</span> request.method == <span class="string">&#x27;POST&#x27;</span>:</span><br><span class="line">            <span class="comment"># 获取到用户数据</span></span><br><span class="line">            old_password = request.POST.get(<span class="string">&#x27;old_password&#x27;</span>)</span><br><span class="line">            new_password = request.POST.get(<span class="string">&#x27;new_password&#x27;</span>)</span><br><span class="line">            confirm_password = request.POST.get(<span class="string">&#x27;confirm_password&#x27;</span>)</span><br><span class="line">            <span class="comment"># 对比两次密码是否一致</span></span><br><span class="line">            <span class="keyword">if</span> new_password == confirm_password:</span><br><span class="line">                <span class="comment"># 对比老密码是否正确,这个地方得用新方法</span></span><br><span class="line">                is_right = request.user.check_password(old_password)</span><br><span class="line">                <span class="keyword">if</span> is_right:</span><br><span class="line">                    request.user.set_password(new_password)  <span class="comment"># 仅仅是在修改对象属性</span></span><br><span class="line">                    request.user.save()  <span class="comment"># 这一步才是真正保存进数据库的一步</span></span><br><span class="line">                    <span class="keyword">return</span> HttpResponse(<span class="string">&#x27;success&#x27;</span>)</span><br><span class="line">        <span class="keyword">return</span> render(request, <span class="string">&#x27;set_password.html&#x27;</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">logout</span>(<span class="params">request</span>):</span></span><br><span class="line">        auth.logout(request)</span><br><span class="line">        <span class="keyword">return</span> redirect(<span class="string">&#x27;/login/&#x27;</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">register</span>(<span class="params">request</span>):</span></span><br><span class="line">        <span class="keyword">if</span> request.method == <span class="string">&#x27;POST&#x27;</span>:</span><br><span class="line">            username = request.POST.get(<span class="string">&#x27;username&#x27;</span>)</span><br><span class="line">            password = request.POST.get(<span class="string">&#x27;password&#x27;</span>)</span><br><span class="line">            User.objects.create_user(username=username, password=password)</span><br><span class="line">        <span class="keyword">return</span> render(request, <span class="string">&#x27;form_input.html&#x27;</span>)</span><br><span class="line"></span><br><span class="line">    </span><br><span class="line"><span class="comment"># urls</span></span><br><span class="line">    <span class="keyword">from</span> django.conf.urls <span class="keyword">import</span> url</span><br><span class="line">    <span class="keyword">from</span> django.contrib <span class="keyword">import</span> admin</span><br><span class="line">    <span class="keyword">from</span> app01 <span class="keyword">import</span> views</span><br><span class="line">    urlpatterns = [</span><br><span class="line">        url(<span class="string">r&#x27;^admin/&#x27;</span>, admin.site.urls),</span><br><span class="line">        url(<span class="string">r&#x27;^index/&#x27;</span>, views.form_input),</span><br><span class="line">        url(<span class="string">r&#x27;^home/&#x27;</span>, views.home),</span><br><span class="line">        url(<span class="string">r&#x27;^set_password/&#x27;</span>, views.set_password),</span><br><span class="line">        url(<span class="string">r&#x27;^logout/&#x27;</span>, views.logout),</span><br><span class="line">    	url(<span class="string">r&#x27;^register/&#x27;</span>, views.register),</span><br><span class="line">    ]</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h2 id="三、基于auth模块的使用总结方法"><a href="#三、基于auth模块的使用总结方法" class="headerlink" title="三、基于auth模块的使用总结方法"></a>三、基于auth模块的使用总结方法</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span> 对比用户名&amp;密码是否正确</span><br><span class="line">	user_obj = auth.authenticate(request, username=username, password=password)</span><br><span class="line">    <span class="comment"># 括号内必须传入用户名和密码</span></span><br><span class="line">    <span class="built_in">print</span>(user_obj)</span><br><span class="line">    <span class="built_in">print</span>(user_obj.username)</span><br><span class="line">    <span class="built_in">print</span>(user_obj.password)</span><br><span class="line"><span class="number">2.</span> 保存用户状态</span><br><span class="line">	auth.login(request, user_obj)</span><br><span class="line">    <span class="comment"># 执行了该方法 无论在哪都能request.user</span></span><br><span class="line"><span class="number">3.</span> 判断用户当前是否登录</span><br><span class="line">	request.user.is_anthenticated()</span><br><span class="line"><span class="number">4.</span> 获取当前用户</span><br><span class="line">	request.user</span><br><span class="line"><span class="number">5.</span> 校验用户是否登录装饰器</span><br><span class="line">	<span class="keyword">from</span> django.contrib.auth.decorators <span class="keyword">import</span> login_required</span><br><span class="line">    <span class="comment"># 局部配置</span></span><br><span class="line"><span class="meta">    @login_required(<span class="params">login_url=<span class="string">&#x27;/login/&#x27;</span></span>)</span></span><br><span class="line">    <span class="comment"># 全局配置</span></span><br><span class="line">    LOGIN_URL = <span class="string">&#x27;/LOGIN/&#x27;</span></span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    1.如果同时有局部和全局，应该听谁的</span></span><br><span class="line"><span class="string">    	局部&gt;全局</span></span><br><span class="line"><span class="string">    2.局部和全局那个好呢</span></span><br><span class="line"><span class="string">    	全局的好处在于不用写重复代码 但是跳转页面都很单一</span></span><br><span class="line"><span class="string">    	局部的好处在于不同的视图函数在用户没有登录的情况下可以跳转到不同的页面</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line"><span class="number">6.</span> 比对原密码</span><br><span class="line">	request.user.check_password(old_password)</span><br><span class="line"><span class="number">7.</span> 修改密码</span><br><span class="line">	request.user.set_password(new_password)  <span class="comment"># 只是改变了对象属性</span></span><br><span class="line">    request.user.save()  <span class="comment"># 这才是修改数据库数据</span></span><br><span class="line"><span class="number">8.</span> 注销密码</span><br><span class="line">	auth.logout(request)</span><br><span class="line"><span class="number">9.</span> 注册用户</span><br><span class="line">	<span class="comment"># 创建普通用户</span></span><br><span class="line">    User.objects.create_user(username=username, password=password)</span><br><span class="line">    <span class="comment"># 创建超级用户</span></span><br><span class="line">	User.objects.create_superuser(username=username, email=<span class="string">&#x27;123@qq.com&#x27;</span>, password=password)</span><br><span class="line">    <span class="comment"># 在这里创建超级用户必须要填邮箱，而命令行却不用</span></span><br></pre></td></tr></table></figure>

<h2 id="四、auth模块包拓展"><a href="#四、auth模块包拓展" class="headerlink" title="四、auth模块包拓展"></a>四、auth模块包拓展</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span> 代码演示</span><br><span class="line">    <span class="keyword">from</span> django.db <span class="keyword">import</span> models</span><br><span class="line">    <span class="keyword">from</span> django.contrib.auth.models <span class="keyword">import</span> User, AbstractUser</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="comment"># Create your models here.</span></span><br><span class="line"></span><br><span class="line">    <span class="comment"># 第一种方法  一对一表关系 不推荐</span></span><br><span class="line">    <span class="class"><span class="keyword">class</span> <span class="title">UserDetail</span>(<span class="params">models.Model</span>):</span></span><br><span class="line">        phone = models.CharField(max_length=<span class="number">16</span>)</span><br><span class="line">        user = models.OneToOneField(to=<span class="string">&#x27;User&#x27;</span>)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 第二种方法</span></span><br><span class="line">    <span class="class"><span class="keyword">class</span> <span class="title">UserInfo</span>(<span class="params">AbstractUser</span>):</span></span><br><span class="line">        <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">        如果执行了AbstractUser</span></span><br><span class="line"><span class="string">        那么在执行数据库迁移命令的时候auth_user表就不会再创建出来了</span></span><br><span class="line"><span class="string">        而UserInfo表中会出现auth_user所有的字段外加自己扩展的阻断</span></span><br><span class="line"><span class="string">        这么做的好处在于你能够直接点击你自己的表更加快速的完成操作及扩展</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">        前提:</span></span><br><span class="line"><span class="string">            1.在继承之前没有执行过数据库迁移命令</span></span><br><span class="line"><span class="string">                auth_user没有被创建 如果当前库已经创建了那么你就重新换一个库</span></span><br><span class="line"><span class="string">            2.继承的类里面不要覆盖AbstractUser里面的字段名</span></span><br><span class="line"><span class="string">                表里面有的字段都不要动，至扩展额外字段即可</span></span><br><span class="line"><span class="string">            3.需要在配置文件中告诉django你要用UserInfo代替auth_user</span></span><br><span class="line"><span class="string">                AUTH_USER_MODEL = &#x27;app01.UserInfo&#x27;</span></span><br><span class="line"><span class="string">                                    &#x27;应用名.表名&#x27;    </span></span><br><span class="line"><span class="string">        &quot;&quot;&quot;</span></span><br><span class="line">        phone = models.BigIntegerField()</span><br></pre></td></tr></table></figure>


            </div>

            <!-- Post Comments -->
            
    <!-- 使用 DISQUS_CLICK -->
<div id="disqus-comment">
    <div id="disqus_thread"></div>

<!-- add animation -->
<style>
	.disqus_click_btn {
            line-height: 30px;
            margin: 0;
            min-width: 50px;
            padding: 0 14px;
            display: inline-block;
            font-family: "Roboto", "Helvetica", "Arial", sans-serif;
            font-size: 14px;
            font-weight: 400;
            text-transform: uppercase;
            letter-spacing: 0;
            overflow: hidden;
            will-change: box-shadow;
            transition: box-shadow .2s cubic-bezier(.4, 0, 1, 1), background-color .2s cubic-bezier(.4, 0, .2, 1), color .2s cubic-bezier(.4, 0, .2, 1);
            outline: 0;
            cursor: pointer;
            text-decoration: none;
            text-align: center;
            vertical-align: middle;
            border: 0;
            background: rgba(158, 158, 158, .2);
            box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
            color: #fff;
            background-color: #7EC0EE;
            text-shadow: 0
        }
</style>
	
<div class="btn_click_load" id="disqus_bt"> 
    <button class="disqus_click_btn">点击查看评论</button>
</div>

<!--
<script type="text/javascript">
$('.btn_click_load').click(function() {
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = 'http-miccall-tech'; // required: replace example with your forum shortname

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function() {
      var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
      dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
      (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();

    document.getElementById('disqus_bt').style.display = "none";
});
</script>
-->
<script type="text/javascript">
    var disqus_config = function () {
        this.page.url = 'https://gitee.com/AmeX/amelin-ting.git/2018/05/08/Django------auth/';  // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = 'https://gitee.com/AmeX/amelin-ting.git/2018/05/08/Django------auth/'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
</script>

<script type="text/javascript">
    $('.btn_click_load').click(function() {  //click to load comments
        (function() { // DON'T EDIT BELOW THIS LINE
            var d = document;
            var s = d.createElement('script');
            s.src = '//http-miccall-tech.disqus.com/embed.js';
            s.setAttribute('data-timestamp', + new Date());
            (d.head || d.body).appendChild(s);
        })();
        $('.btn_click_load').css('display','none');
    });
</script>
</div>
<style>
    #disqus-comment{
        background-color: #eee;
        padding: 2pc;
    }
</style>


        </div>
        <!-- Copyright 版权 start -->
                <div id="copyright">
            <ul>
                <li>&copy;Powered By <a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/" style="border-bottom: none;">hexo</a></li>
                <li>Design: <a target="_blank" rel="noopener" href="http://miccall.tech " style="border-bottom: none;">miccall</a></li>
            </ul>
            
                <span id="busuanzi_container_site_pv">本站总访问量<span id="busuanzi_value_site_pv"></span>次</span>
			
        </div>
    </div>
</body>



 	
</html>
